<!DOCTYPE html><html lang="en" data-theme="light"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Ywrby个人博客网站 - less is more</title><meta name="author" content="Ywrby"><meta name="copyright" content="Ywrby"><meta name="format-detection" content="telephone=no"><meta name="theme-color" content="#ffffff"><meta name="description" content="Students majoring in CS at SWU">
<meta property="og:type" content="website">
<meta property="og:title" content="Ywrby个人博客网站">
<meta property="og:url" content="http://ywrby.cn/page/10/index.html">
<meta property="og:site_name" content="Ywrby个人博客网站">
<meta property="og:description" content="Students majoring in CS at SWU">
<meta property="og:locale" content="en_US">
<meta property="og:image" content="http://ywrby.cn/img/ywrby.png">
<meta property="article:author" content="Ywrby">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="http://ywrby.cn/img/ywrby.png"><link rel="shortcut icon" href="/img/title.png"><link rel="canonical" href="http://ywrby.cn/page/10/"><link rel="preconnect" href="//cdn.jsdelivr.net"/><link rel="preconnect" href="//busuanzi.ibruce.info"/><link rel="stylesheet" href="/css/index.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free/css/all.min.css" media="print" onload="this.media='all'"><script>const GLOBAL_CONFIG = { 
  root: '/',
  algolia: undefined,
  localSearch: {"path":"search.xml","languages":{"hits_empty":"We didn't find any results for the search: ${query}"}},
  translate: undefined,
  noticeOutdate: undefined,
  highlight: {"plugin":"highlighjs","highlightCopy":true,"highlightLang":true,"highlightHeightLimit":false},
  copy: {
    success: 'Copy successfully',
    error: 'Copy error',
    noSupport: 'The browser does not support'
  },
  relativeDate: {
    homepage: false,
    post: false
  },
  runtime: '',
  date_suffix: {
    just: 'Just',
    min: 'minutes ago',
    hour: 'hours ago',
    day: 'days ago',
    month: 'months ago'
  },
  copyright: undefined,
  lightbox: 'fancybox',
  Snackbar: undefined,
  source: {
    jQuery: 'https://cdn.jsdelivr.net/npm/jquery@latest/dist/jquery.min.js',
    justifiedGallery: {
      js: 'https://cdn.jsdelivr.net/npm/justifiedGallery/dist/js/jquery.justifiedGallery.min.js',
      css: 'https://cdn.jsdelivr.net/npm/justifiedGallery/dist/css/justifiedGallery.min.css'
    },
    fancybox: {
      js: 'https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@latest/dist/jquery.fancybox.min.js',
      css: 'https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@latest/dist/jquery.fancybox.min.css'
    }
  },
  isPhotoFigcaption: false,
  islazyload: false,
  isanchor: false
}</script><script id="config-diff">var GLOBAL_CONFIG_SITE = {
  title: 'Ywrby个人博客网站',
  isPost: false,
  isHome: true,
  isHighlightShrink: false,
  isToc: false,
  postUpdate: '2021-12-25 18:42:00'
}</script><noscript><style type="text/css">
  #nav {
    opacity: 1
  }
  .justified-gallery img {
    opacity: 1
  }

  #recent-posts time,
  #post-meta time {
    display: inline !important
  }
</style></noscript><script>(win=>{
    win.saveToLocal = {
      set: function setWithExpiry(key, value, ttl) {
        if (ttl === 0) return
        const now = new Date()
        const expiryDay = ttl * 86400000
        const item = {
          value: value,
          expiry: now.getTime() + expiryDay,
        }
        localStorage.setItem(key, JSON.stringify(item))
      },

      get: function getWithExpiry(key) {
        const itemStr = localStorage.getItem(key)

        if (!itemStr) {
          return undefined
        }
        const item = JSON.parse(itemStr)
        const now = new Date()

        if (now.getTime() > item.expiry) {
          localStorage.removeItem(key)
          return undefined
        }
        return item.value
      }
    }
  
    win.getScript = url => new Promise((resolve, reject) => {
      const script = document.createElement('script')
      script.src = url
      script.async = true
      script.onerror = reject
      script.onload = script.onreadystatechange = function() {
        const loadState = this.readyState
        if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
        script.onload = script.onreadystatechange = null
        resolve()
      }
      document.head.appendChild(script)
    })
  
      win.activateDarkMode = function () {
        document.documentElement.setAttribute('data-theme', 'dark')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#0d0d0d')
        }
      }
      win.activateLightMode = function () {
        document.documentElement.setAttribute('data-theme', 'light')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#ffffff')
        }
      }
      const t = saveToLocal.get('theme')
    
          if (t === 'dark') activateDarkMode()
          else if (t === 'light') activateLightMode()
        
      const asideStatus = saveToLocal.get('aside-status')
      if (asideStatus !== undefined) {
        if (asideStatus === 'hide') {
          document.documentElement.classList.add('hide-aside')
        } else {
          document.documentElement.classList.remove('hide-aside')
        }
      }
    
    const detectApple = () => {
      if (GLOBAL_CONFIG_SITE.isHome && /iPad|iPhone|iPod|Macintosh/.test(navigator.userAgent)){
        document.documentElement.classList.add('apple')
      }
    }
    detectApple()
    document.addEventListener('pjax:complete', detectApple)})(window)</script><link rel="stylesheet" href="/css/background.css"><meta name="generator" content="Hexo 5.4.0"><link rel="alternate" href="/atom.xml" title="Ywrby个人博客网站" type="application/atom+xml">
</head><body><div id="web_bg"></div><div id="sidebar"><div id="menu-mask"></div><div id="sidebar-menus"><div class="avatar-img is-center"><img src="/img/ywrby.png" onerror="onerror=null;src='/img/friend_404.gif'" alt="avatar"/></div><div class="site-data"><div class="data-item is-center"><div class="data-item-link"><a href="/archives/"><div class="headline">Articles</div><div class="length-num">127</div></a></div></div><div class="data-item is-center"><div class="data-item-link"><a href="/tags/"><div class="headline">Tags</div><div class="length-num">22</div></a></div></div></div><hr/><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> 主页</span></a></div><div class="menus_item"><a class="site-page" href="/archives/"><i class="fa-fw fas fa-archive"></i><span> 归档</span></a></div><div class="menus_item"><a class="site-page" href="/tags/"><i class="fa-fw fas fa-tags"></i><span> 标签</span></a></div><div class="menus_item"><a class="site-page" href="javascript:void(0);"><i class="fa-fw fas fa-list"></i><span> Bilibili</span><i class="fas fa-chevron-down expand"></i></a><ul class="menus_item_child"><li><a class="site-page child" href="/bangumis/"><i class="fa-fw fas fa-video"></i><span> 追番列表</span></a></li><li><a class="site-page child" target="_blank" rel="noopener" href="https://space.bilibili.com/353923033"><i class="fa-fw fas fa-music"></i><span> B站主页</span></a></li></ul></div><div class="menus_item"><a class="site-page" href="/about/"><i class="fa-fw fas fa-heart"></i><span> 关于我</span></a></div></div></div></div><div class="page" id="body-wrap"><header class="full_page" id="page-header" style="background-image: url('/img/back.jpg')"><nav id="nav"><span id="blog_name"><a id="site-name" href="/">Ywrby个人博客网站</a></span><div id="menus"><div id="search-button"><a class="site-page social-icon search"><i class="fas fa-search fa-fw"></i><span> Search</span></a></div><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> 主页</span></a></div><div class="menus_item"><a class="site-page" href="/archives/"><i class="fa-fw fas fa-archive"></i><span> 归档</span></a></div><div class="menus_item"><a class="site-page" href="/tags/"><i class="fa-fw fas fa-tags"></i><span> 标签</span></a></div><div class="menus_item"><a class="site-page" href="javascript:void(0);"><i class="fa-fw fas fa-list"></i><span> Bilibili</span><i class="fas fa-chevron-down expand"></i></a><ul class="menus_item_child"><li><a class="site-page child" href="/bangumis/"><i class="fa-fw fas fa-video"></i><span> 追番列表</span></a></li><li><a class="site-page child" target="_blank" rel="noopener" href="https://space.bilibili.com/353923033"><i class="fa-fw fas fa-music"></i><span> B站主页</span></a></li></ul></div><div class="menus_item"><a class="site-page" href="/about/"><i class="fa-fw fas fa-heart"></i><span> 关于我</span></a></div></div><div id="toggle-menu"><a class="site-page"><i class="fas fa-bars fa-fw"></i></a></div></div></nav><div id="site-info"><h1 id="site-title">Ywrby个人博客网站</h1><div id="site-subtitle"><span id="subtitle"></span></div><div id="site_social_icons"><a class="social-icon" href="mailto:ywrby0214@gmail.com" target="_blank" title="Email"><i class="fas fa-envelope"></i></a><a class="social-icon" href="https://space.bilibili.com/353923033" target="_blank" title="Bilibili"><i class="fas fa-file-video"></i></a><a class="social-icon" href="http://wpa.qq.com/msgrd?v=3&amp;uin=2278431384&amp;site=qq&amp;menu=yes" target="_blank" title="QQ"><i class="fab fa-qq"></i></a><a class="social-icon" href="https://twitter.com/ywrby1" target="_blank" title="Twitter"><i class="fab fa-twitter"></i></a><a class="social-icon" href="https://www.facebook.com/profile.php?id=100033741068822" target="_blank" title="Facebook"><i class="fab fa-facebook"></i></a></div></div><div id="scroll-down"><i class="fas fa-angle-down scroll-down-effects"></i></div></header><main class="layout" id="content-inner"><div class="recent-posts" id="recent-posts"><div class="recent-post-item"><div class="post_cover left_radius"><a href="/2021/03/03/9-web%E6%9C%8D%E5%8A%A1%E5%99%A8%E8%BD%AF%E4%BB%B6%E6%A6%82%E8%BF%B0+Tomcat/" title="9-web服务器软件概述+Tomcat">     <img class="post_bg" src="/img/77593329_p0.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="9-web服务器软件概述+Tomcat"></a></div><div class="recent-post-info"><a class="article-title" href="/2021/03/03/9-web%E6%9C%8D%E5%8A%A1%E5%99%A8%E8%BD%AF%E4%BB%B6%E6%A6%82%E8%BF%B0+Tomcat/" title="9-web服务器软件概述+Tomcat">9-web服务器软件概述+Tomcat</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">Created</span><time datetime="2021-03-03T12:28:20.000Z" title="Created 2021-03-03 20:28:20">2021-03-03</time></span><span class="article-meta tags"><span class="article-meta__separator">|</span><i class="fas fa-tag"></i><a class="article-meta__tags" href="/tags/JavaWeb/">JavaWeb</a></span></div><div class="content">Web服务器软件服务器概念安装了服务器软件的计算机
服务器软件概念接收用户请求，处理请求并做出响应
Web服务器软件概念服务器软件的一种，在web服务器软件中，可以部署web项目，让用户通过浏览器访问项目，又被称为web容器
常见的Java相关的web服务器软件
webLogic:oracle公司的，大型JavaEE服务器，支持所有JavaEE规范，收费。
webSphere:IBM公司，大型JavaEE服务器，支持所有JavaEE规范，收费。
JBOSS:JBOSS公司，大型JavaEE服务器，支持所有JavaEE规范，收费。
Tomcat:Apache基金组织的，中小型JavaEE服务器，仅支持少量的JavaEE规范（如：servlet/jsp）开源免费的

Tomacat
下载：https://tomcat.apache.org/
安装：解压缩文件到本地即可
卸载：删除解压文件夹
启动：bin/startup.bat双击运行
访问：浏览器输入http://localhost:8080 (本地访问方式，非本地将localhost替换为本机IP地址即可)
关闭
正常关闭：1. bin ...</div></div></div><div class="recent-post-item"><div class="post_cover right_radius"><a href="/2021/03/03/8-XML%E6%A6%82%E8%BF%B0/" title="8-XML概述">     <img class="post_bg" src="/img/83821828_p0.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="8-XML概述"></a></div><div class="recent-post-info"><a class="article-title" href="/2021/03/03/8-XML%E6%A6%82%E8%BF%B0/" title="8-XML概述">8-XML概述</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">Created</span><time datetime="2021-03-03T12:28:08.000Z" title="Created 2021-03-03 20:28:08">2021-03-03</time></span><span class="article-meta tags"><span class="article-meta__separator">|</span><i class="fas fa-tag"></i><a class="article-meta__tags" href="/tags/JavaWeb/">JavaWeb</a></span></div><div class="content">XML概述概念Extensible Markup Language可扩展标记语言（可扩展指XML中的所有标签都是自定义的）
功能
存储数据
做配置文件
在网络中传输



XML与HTML区别
XML标签都是自定义的，HTML标签都是预定义的
XML语法严格，HTML语法松散
XML是用来存储数据的，HTML是用来展示数据的

基本要求
xml文档的后缀名.xml
xml第一行必须定义为文档声明。例如：&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
xml文档中有且仅有一个根标签
属性值必须使用引号(单双都可)引起来
标签必须正确关闭
xml标签名称区分大小写

组成部分1. 文档声明
格式：
属性列表组成
version：版本号，必须的属性
encoding：编码方式，告知解析引擎当前文档使用的字符集
standalone：是否独立（yes：不依赖其他文件，no：依赖其他文件）



2. 标签：自定义名称
3. 属性：（注意id属性值唯一）
4. 文本：由于我们保存的文本数据可能包含一些有特殊意义的字 ...</div></div></div><div class="recent-post-item"><div class="post_cover left_radius"><a href="/2021/03/03/7-%E8%BD%AF%E4%BB%B6%E6%9E%B6%E6%9E%84%EF%BC%8C%E8%B5%84%E6%BA%90%E5%88%86%E7%B1%BB/" title="7-软件架构，资源分类">     <img class="post_bg" src="/img/83821828_p0.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="7-软件架构，资源分类"></a></div><div class="recent-post-info"><a class="article-title" href="/2021/03/03/7-%E8%BD%AF%E4%BB%B6%E6%9E%B6%E6%9E%84%EF%BC%8C%E8%B5%84%E6%BA%90%E5%88%86%E7%B1%BB/" title="7-软件架构，资源分类">7-软件架构，资源分类</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">Created</span><time datetime="2021-03-03T12:28:07.000Z" title="Created 2021-03-03 20:28:07">2021-03-03</time></span><span class="article-meta tags"><span class="article-meta__separator">|</span><i class="fas fa-tag"></i><a class="article-meta__tags" href="/tags/JavaWeb/">JavaWeb</a></span></div><div class="content">软件架构C/S(Client/Server)客户端/服务器端
在用户本地有客户端程序，在远程由服务器端程序（例如QQ，迅雷）

优点：用户体验好
缺点：开发，安装，部署，维护等十分麻烦

B/S(Browser/Server)浏览器/服务器端
只需要一个浏览器，用户就可以通过URL访问不同服务器端程序

优点：开发，安装，部署，维护等十分更简单
缺点：
如果应用过大，用户体验可能受到影响
对硬件要求高



B/S架构 资源分类静态资源使用静态网页开发技术发布的资源
特点：
所有用户访问，得到的页面完全一致
如：文本，图片，音视频，HTML，CSS，JavaScript
如果用户请求的是静态资源，服务器会直接将静态资源发送给浏览器，浏览器中内置静态资源的解析引擎，可以展示静态资源

动态资源使用动态网页技术发布的资源
特点：
所有用户访问。得到的结果可能是不一样的
如：Jsp/Servlet,php,asp
如果用户请求的是动态资源，服务器会执行动态资源，将其转换为静态资源，再发送给浏览器

</div></div></div><div class="recent-post-item"><div class="post_cover right_radius"><a href="/2021/03/03/6-JDBCTemplate/" title="6-JDBCTemplate">     <img class="post_bg" src="/img/68304874_p0.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="6-JDBCTemplate"></a></div><div class="recent-post-info"><a class="article-title" href="/2021/03/03/6-JDBCTemplate/" title="6-JDBCTemplate">6-JDBCTemplate</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">Created</span><time datetime="2021-03-03T12:28:06.000Z" title="Created 2021-03-03 20:28:06">2021-03-03</time></span><span class="article-meta tags"><span class="article-meta__separator">|</span><i class="fas fa-tag"></i><a class="article-meta__tags" href="/tags/JavaWeb/">JavaWeb</a></span></div><div class="content">JDBCTemplateSpring JDBC是Spring框架对JDBC的简单封装，其中提供了JDBCTemplate对象简化JDBC开发
使用步骤
导入jar包：commons-logging-1.2.jar，spring-beans-5.1.10.RELEASE.jar，spring-core-5.1.10.RELEASE.jar，spring-jdbc-5.1.10.RELEASE.jar，spring-tx-5.1.10.RELEASE.jar
创建JdbcTemplate对象，依赖于数据源DataSource
调用JdbdTemplate的方法进行CRUD增删改查
update():执行DML语句
queryForMap():查询结果并将结果封装为map对象（查询结果长度只能是1，也就是只能查询一条结果，查询到的结果将被封装为Map，其中列名为Key，值为Value）
queryForList():查询结果并将结果封装为list对象（将每一条记录封装为一个Map集合，再将多个Map集合封装为一个List集合）
query():查询结果并将结果封装为JavaBean对象。qu ...</div></div></div><div class="recent-post-item"><div class="post_cover left_radius"><a href="/2021/03/03/5-%E6%95%B0%E6%8D%AE%E5%BA%93%E8%BF%9E%E6%8E%A5%E6%B1%A0/" title="5-数据库连接池">     <img class="post_bg" src="/img/73604608_p0.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="5-数据库连接池"></a></div><div class="recent-post-info"><a class="article-title" href="/2021/03/03/5-%E6%95%B0%E6%8D%AE%E5%BA%93%E8%BF%9E%E6%8E%A5%E6%B1%A0/" title="5-数据库连接池">5-数据库连接池</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">Created</span><time datetime="2021-03-03T12:28:05.000Z" title="Created 2021-03-03 20:28:05">2021-03-03</time></span><span class="article-meta tags"><span class="article-meta__separator">|</span><i class="fas fa-tag"></i><a class="article-meta__tags" href="/tags/JavaWeb/">JavaWeb</a></span></div><div class="content">数据库连接池
数据库连接池负责分配、管理和释放数据库连接，它允许应用程序重复使用一个现有的数据库连接，而不是再重新建立一个；释放空闲时间超过最大空闲时间的数据库连接来避免因为没有释放数据库连接而引起的数据库连接遗漏。这项技术能明显提高对数据库操作的性能。(用户访问更加高效，消耗资源减少)

数据库连接池的实现标准接口：DataSource位于javax.sql包下，通过方法getConnection获取连接
如果Connection对象是从连接池中直接获取的，则调用Connection的close方法不再关闭连接，而是将该连接归还给连接池
数据库连接池一般由数据库厂商直接实现，我们不需要另行实现

C3P0：数据库连接池实现技术
Druid：数据库连接池实现技术，由阿里巴巴提供

C3P0使用步骤
导入jar包：c3p0-0.9.5.5.jar和mchange-commons-java-0.2.19.jar（依赖jar包）另外因为要使用数据库连接对象，所以不要忘记导入mysql-connector-java-8.0.20.jar包
定义配置文件
名称需为：c3p0.properties ...</div></div></div><div class="recent-post-item"><div class="post_cover right_radius"><a href="/2021/03/03/4-JDBC/" title="4-JDBC">     <img class="post_bg" src="/img/73143110_p0.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="4-JDBC"></a></div><div class="recent-post-info"><a class="article-title" href="/2021/03/03/4-JDBC/" title="4-JDBC">4-JDBC</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">Created</span><time datetime="2021-03-03T12:28:04.000Z" title="Created 2021-03-03 20:28:04">2021-03-03</time></span><span class="article-meta tags"><span class="article-meta__separator">|</span><i class="fas fa-tag"></i><a class="article-meta__tags" href="/tags/JavaWeb/">JavaWeb</a></span></div><div class="content">JDBC Java数据库连接(Java Database Connectivity)JDBC本质本质是sun公司制作的一套操作所有关系型数据库的规则，即接口。各个数据库厂商负责实现这些接口，提供响应的数据库驱动jar包，我们可以使用这套接口（JDBC）编程，最终真正执行的是数据库驱动jar包中的实现类
基本流程
导入驱动jar包
在项目中新建libs目录(和src同级)
将mysql-connector-java-8.0.20.jar复制到libs目录中
右键libs目录，将该目录添加到library(add as library)


注册驱动
获取数据库连接对象Connection
定义sql
获取执行sql语句的对象statement
执行sql，接收返回结果
处理结果
释放资源

1234567891011121314151617181920212223public class JDBCDemo1 &#123;    public static void main(String[] args) throws Exception &#123;        //注册驱动      ...</div></div></div><div class="recent-post-item"><div class="post_cover left_radius"><a href="/2021/03/03/3-%E6%B3%A8%E8%A7%A3/" title="3-注解">     <img class="post_bg" src="/img/68304874_p0.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="3-注解"></a></div><div class="recent-post-info"><a class="article-title" href="/2021/03/03/3-%E6%B3%A8%E8%A7%A3/" title="3-注解">3-注解</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">Created</span><time datetime="2021-03-03T12:28:03.000Z" title="Created 2021-03-03 20:28:03">2021-03-03</time></span><span class="article-meta tags"><span class="article-meta__separator">|</span><i class="fas fa-tag"></i><a class="article-meta__tags" href="/tags/JavaWeb/">JavaWeb</a></span></div><div class="content">注解
从JDK5开始,Java增加对元数据的支持，也就是注解，注解是一种代码级别的说明。注解与注释是有一定区别的，可以把注解理解为代码里的特殊标记，这些标记可以在编译，类加载，运行时被读取，并执行相应的处理。通过注解开发人员可以在不改变原有代码和逻辑的情况下在源代码中嵌入补充信息。

作用分类
编写文档：通过代码里标识的注解生成doc文档
代码分析：通过代码里标识的注解进行代码分析（使用反射）
编译检查：通过代码里标识的注解对代码进行基本的编译检查

JDK内置注解
@Override： 检测被注解的方法是否继承自父类/父接口，不是则报错
@Deprecated： 将该注解标注的内容标识为已过时的内容
@SuppressWarnings： 压制警告， 指示编译器去忽略注解中声明的警告。（一般传递参数”all”压制所有警告）
@SafeVarargs：  Java 7 开始支持，忽略任何使用参数为泛型变量的方法或构造函数调用产生的警告。
@FunctionalInterface：   Java 8 开始支持，标识一个匿名函数或函数式接口。

自定义注解1234//自定义注解的格式元注解. ...</div></div></div><div class="recent-post-item"><div class="post_cover right_radius"><a href="/2021/03/03/2-%E5%8F%8D%E5%B0%84/" title="2-反射">     <img class="post_bg" src="/img/66150863_p0.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="2-反射"></a></div><div class="recent-post-info"><a class="article-title" href="/2021/03/03/2-%E5%8F%8D%E5%B0%84/" title="2-反射">2-反射</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">Created</span><time datetime="2021-03-03T12:27:58.000Z" title="Created 2021-03-03 20:27:58">2021-03-03</time></span><span class="article-meta tags"><span class="article-meta__separator">|</span><i class="fas fa-tag"></i><a class="article-meta__tags" href="/tags/JavaWeb/">JavaWeb</a></span></div><div class="content">反射框架设计的灵魂，反射机制就是指将类的各个组成部分封装成其他对象
框架半成品的软件，可以在其基础上进行软件开发，简化代码
反射机制的好处
可以在程序运行过程中操作这些对象
可以解耦，提高程序可扩展性

Java代码在计算机中的三个运行阶段
（第二阶段通过类加载器将源代码阶段的字节码文件加载进了内存）
三个阶段获取Class对象的方法源代码阶段Class.forName(“全类名”)：将字节码文件加载进内存，返回Class类对象
多用于配置文件，将类名定义在配置文件中，读取文件，加载类
Class类对象阶段通过 类名.class：通过类名的属性class获取
多用于参数传递时
运行时阶段通过 对象.getClass() 获取（getClass方法定义在Object类中，所以所有对象都具有该方法）
多用于对象已被创建后，通过对象获取字节码文件
1234567891011121314151617181920212223242526/** * 获取Class对象的三种方法 */public class ReflectDemo1 &#123;    public static void mai ...</div></div></div><div class="recent-post-item"><div class="post_cover left_radius"><a href="/2021/03/03/1-Junit%E5%8D%95%E5%85%83%E6%B5%8B%E8%AF%95/" title="1-Junit单元测试">     <img class="post_bg" src="/img/67888138_p0.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="1-Junit单元测试"></a></div><div class="recent-post-info"><a class="article-title" href="/2021/03/03/1-Junit%E5%8D%95%E5%85%83%E6%B5%8B%E8%AF%95/" title="1-Junit单元测试">1-Junit单元测试</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">Created</span><time datetime="2021-03-03T12:27:51.000Z" title="Created 2021-03-03 20:27:51">2021-03-03</time></span><span class="article-meta tags"><span class="article-meta__separator">|</span><i class="fas fa-tag"></i><a class="article-meta__tags" href="/tags/JavaWeb/">JavaWeb</a></span></div><div class="content">Junit单元测试测试分类
黑盒测试：
在测试中，把程序看作一个不能打开的黑盒子，在完全不考虑程序内部结构和内部特性的情况下，在程序接口进行测试，它只检查程序功能是否按照需求规格说明书的规定正常使用，程序是否能适当地接收输入数据而产生正确的输出信息。


白盒测试：
白盒测试是一种测试用例设计方法，盒子指的是被测试的软件，白盒指的是盒子是可视的，即清楚盒子内部的东西以及里面是如何运作的。”白盒”法全面了解程序内部逻辑结构、对所有逻辑路径进行测试。



Junit步骤（白盒测试）1. 定义一个测试类（也叫测试用例）测试类名一般采用：被测试类名+Test的格式。例如，Calculator的测试类叫做CalculatorTest
测试包名一般叫做test，例如：cn.ywrby.test
2. 定义测试方法（可以独立运行）方法名一般采用：test+测试的方法名的格式，例如add方法的测试方法是testAdd方法
返回值一般为void，参数列表一般为空
3.导入Junit依赖环境4. 给方法加@Test5. 结果判定显示红色，测试失败，显示绿色，测试成功。一般使用断言操作来测试结果
1234 ...</div></div></div><div class="recent-post-item"><div class="post_cover right_radius"><a href="/2021/03/03/4-Bootstrap%E5%89%8D%E7%AB%AF%E6%A1%86%E6%9E%B6/" title="4-Bootstrap前端框架">     <img class="post_bg" src="/img/81691339_p0.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="4-Bootstrap前端框架"></a></div><div class="recent-post-info"><a class="article-title" href="/2021/03/03/4-Bootstrap%E5%89%8D%E7%AB%AF%E6%A1%86%E6%9E%B6/" title="4-Bootstrap前端框架">4-Bootstrap前端框架</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">Created</span><time datetime="2021-03-03T12:22:37.000Z" title="Created 2021-03-03 20:22:37">2021-03-03</time></span><span class="article-meta tags"><span class="article-meta__separator">|</span><i class="fas fa-tag"></i><a class="article-meta__tags" href="/tags/JavaScript/">JavaScript</a></span></div><div class="content">
Bootstrap是美国Twitter公司的设计师Mark Otto和Jacob Thornton合作基于HTML、CSS、JavaScript 开发的简洁、直观、强悍的前端开发框架，使得 Web 开发更加快捷。Bootstrap提供了优雅的HTML和CSS规范，它即是由动态CSS语言Less写成。Bootstrap一经推出后颇受欢迎，一直是GitHub上的热门开源项目，包括NASA的MSNBC（微软全国广播公司）的Breaking News都使用了该项目。国内一些移动开发者较为熟悉的框架，如WeX5前端开源框架等，也是基于Bootstrap源码进行性能优化而来。

优点
定义了很多CSS样式和JS插件，使得开发人员不需要经过太多设置便可以得到一个丰富的页面效果
采用响应式布局，可以自动适配不同分辨率大小的设备

标准Bootstrap页面模板123456789101112131415161718192021&lt;!DOCTYPE html&gt;&lt;html lang=&quot;zh-CN&quot;&gt;  &lt;head&gt;    &lt;meta charse ...</div></div></div><nav id="pagination"><div class="pagination"><a class="extend prev" rel="prev" href="/page/9/#content-inner"><i class="fas fa-chevron-left fa-fw"></i></a><a class="page-number" href="/">1</a><span class="space">&hellip;</span><a class="page-number" href="/page/9/#content-inner">9</a><span class="page-number current">10</span><a class="page-number" href="/page/11/#content-inner">11</a><span class="space">&hellip;</span><a class="page-number" href="/page/13/#content-inner">13</a><a class="extend next" rel="next" href="/page/11/#content-inner"><i class="fas fa-chevron-right fa-fw"></i></a></div></nav></div><div class="aside-content" id="aside-content"><div class="card-widget card-info"><div class="is-center"><div class="avatar-img"><img src="/img/ywrby.png" onerror="this.onerror=null;this.src='/img/friend_404.gif'" alt="avatar"/></div><div class="author-info__name">Ywrby</div><div class="author-info__description">Students majoring in CS at SWU</div></div><div class="card-info-data"><div class="card-info-data-item is-center"><a href="/archives/"><div class="headline">Articles</div><div class="length-num">127</div></a></div><div class="card-info-data-item is-center"><a href="/tags/"><div class="headline">Tags</div><div class="length-num">22</div></a></div></div><a class="button--animated" id="card-info-btn" target="_blank" rel="noopener" href="https://github.com/ywrby"><i class="fab fa-github"></i><span>Follow Me</span></a><div class="card-info-social-icons is-center"><a class="social-icon" href="mailto:ywrby0214@gmail.com" target="_blank" title="Email"><i class="fas fa-envelope"></i></a><a class="social-icon" href="https://space.bilibili.com/353923033" target="_blank" title="Bilibili"><i class="fas fa-file-video"></i></a><a class="social-icon" href="http://wpa.qq.com/msgrd?v=3&amp;uin=2278431384&amp;site=qq&amp;menu=yes" target="_blank" title="QQ"><i class="fab fa-qq"></i></a><a class="social-icon" href="https://twitter.com/ywrby1" target="_blank" title="Twitter"><i class="fab fa-twitter"></i></a><a class="social-icon" href="https://www.facebook.com/profile.php?id=100033741068822" target="_blank" title="Facebook"><i class="fab fa-facebook"></i></a></div></div><div class="card-widget card-announcement"><div class="item-headline"><i class="fas fa-bullhorn card-announcement-animation"></i><span>Announcement</span></div><div class="announcement_content">Less is more</div></div><div class="sticky_layout"><div class="card-widget card-recent-post"><div class="item-headline"><i class="fas fa-history"></i><span>Recent Post</span></div><div class="aside-list"><div class="aside-list-item"><a class="thumbnail" href="/2021/12/25/22-%E5%86%85%E5%AD%98%E7%A9%BA%E9%97%B4%E6%89%A9%E5%85%85%EF%BC%88%E8%A6%86%E7%9B%96%E4%B8%8E%E4%BA%A4%E6%8D%A2%EF%BC%89/" title="22-内存空间扩充（覆盖与交换）"><img src="/img/67888138_p0.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="22-内存空间扩充（覆盖与交换）"/></a><div class="content"><a class="title" href="/2021/12/25/22-%E5%86%85%E5%AD%98%E7%A9%BA%E9%97%B4%E6%89%A9%E5%85%85%EF%BC%88%E8%A6%86%E7%9B%96%E4%B8%8E%E4%BA%A4%E6%8D%A2%EF%BC%89/" title="22-内存空间扩充（覆盖与交换）">22-内存空间扩充（覆盖与交换）</a><time datetime="2021-12-25T08:15:49.000Z" title="Created 2021-12-25 16:15:49">2021-12-25</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/2021/12/19/21-%E5%86%85%E5%AD%98%E4%B8%8E%E5%86%85%E5%AD%98%E7%AE%A1%E7%90%86/" title="21-内存与内存管理"><img src="/img/80857290_p0.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="21-内存与内存管理"/></a><div class="content"><a class="title" href="/2021/12/19/21-%E5%86%85%E5%AD%98%E4%B8%8E%E5%86%85%E5%AD%98%E7%AE%A1%E7%90%86/" title="21-内存与内存管理">21-内存与内存管理</a><time datetime="2021-12-19T09:57:53.000Z" title="Created 2021-12-19 17:57:53">2021-12-19</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/2021/12/11/20-%E6%AD%BB%E9%94%81/" title="20-死锁"><img src="/img/81934649_p0.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="20-死锁"/></a><div class="content"><a class="title" href="/2021/12/11/20-%E6%AD%BB%E9%94%81/" title="20-死锁">20-死锁</a><time datetime="2021-12-11T06:20:20.000Z" title="Created 2021-12-11 14:20:20">2021-12-11</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/2021/11/28/19-%E7%AE%A1%E7%A8%8B/" title="19-管程"><img src="/img/72581222_p0.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="19-管程"/></a><div class="content"><a class="title" href="/2021/11/28/19-%E7%AE%A1%E7%A8%8B/" title="19-管程">19-管程</a><time datetime="2021-11-28T08:39:08.000Z" title="Created 2021-11-28 16:39:08">2021-11-28</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/2021/11/17/18-%E4%BF%A1%E5%8F%B7%E9%87%8F%E7%9B%B8%E5%85%B3%E9%97%AE%E9%A2%98%EF%BC%88%E5%90%B8%E7%83%9F%E8%80%85%EF%BC%8C%E8%AF%BB%E8%80%85-%E5%86%99%E8%80%85%E7%AD%89%EF%BC%89/" title="18-信号量相关问题（吸烟者，读者-写者等）"><img src="/img/73604608_p0.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="18-信号量相关问题（吸烟者，读者-写者等）"/></a><div class="content"><a class="title" href="/2021/11/17/18-%E4%BF%A1%E5%8F%B7%E9%87%8F%E7%9B%B8%E5%85%B3%E9%97%AE%E9%A2%98%EF%BC%88%E5%90%B8%E7%83%9F%E8%80%85%EF%BC%8C%E8%AF%BB%E8%80%85-%E5%86%99%E8%80%85%E7%AD%89%EF%BC%89/" title="18-信号量相关问题（吸烟者，读者-写者等）">18-信号量相关问题（吸烟者，读者-写者等）</a><time datetime="2021-11-17T12:08:38.000Z" title="Created 2021-11-17 20:08:38">2021-11-17</time></div></div></div></div><div class="card-widget card-tags"><div class="item-headline"><i class="fas fa-tags"></i><span>Tags</span></div><div class="card-tag-cloud"><a href="/tags/Docker/" style="font-size: 1.18em; color: #999ca1">Docker</a> <a href="/tags/Electron/" style="font-size: 1.1em; color: #999">Electron</a> <a href="/tags/JVM/" style="font-size: 1.1em; color: #999">JVM</a> <a href="/tags/Java/" style="font-size: 1.38em; color: #99a4b4">Java</a> <a href="/tags/JavaScript/" style="font-size: 1.18em; color: #999ca1">JavaScript</a> <a href="/tags/JavaWeb/" style="font-size: 1.5em; color: #99a9bf">JavaWeb</a> <a href="/tags/Lombok/" style="font-size: 1.1em; color: #999">Lombok</a> <a href="/tags/MyBatis/" style="font-size: 1.22em; color: #999ea4">MyBatis</a> <a href="/tags/MySQL/" style="font-size: 1.34em; color: #99a3b0">MySQL</a> <a href="/tags/P2P/" style="font-size: 1.1em; color: #999">P2P</a> <a href="/tags/Spring/" style="font-size: 1.46em; color: #99a7bb">Spring</a> <a href="/tags/SpringBoot/" style="font-size: 1.26em; color: #999fa8">SpringBoot</a> <a href="/tags/SpringMVC/" style="font-size: 1.3em; color: #99a1ac">SpringMVC</a> <a href="/tags/Swagger/" style="font-size: 1.1em; color: #999">Swagger</a> <a href="/tags/Vue/" style="font-size: 1.14em; color: #999b9d">Vue</a> <a href="/tags/Yaml/" style="font-size: 1.1em; color: #999">Yaml</a> <a href="/tags/tio/" style="font-size: 1.1em; color: #999">tio</a> <a href="/tags/%E5%8C%BA%E5%9D%97%E9%93%BE/" style="font-size: 1.14em; color: #999b9d">区块链</a> <a href="/tags/%E6%93%8D%E4%BD%9C%E7%B3%BB%E7%BB%9F/" style="font-size: 1.42em; color: #99a6b7">操作系统</a> <a href="/tags/%E6%BC%94%E5%8C%96%E5%8D%9A%E5%BC%88/" style="font-size: 1.1em; color: #999">演化博弈</a> <a href="/tags/%E7%AE%97%E6%B3%95/" style="font-size: 1.1em; color: #999">算法</a> <a href="/tags/%E8%AE%A1%E7%AE%97%E6%9C%BA%E7%BD%91%E7%BB%9C/" style="font-size: 1.3em; color: #99a1ac">计算机网络</a></div></div><div class="card-widget card-archives"><div class="item-headline"><i class="fas fa-archive"></i><span>Archives</span></div><ul class="card-archive-list"><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2021/12/"><span class="card-archive-list-date">December 2021</span><span class="card-archive-list-count">3</span></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2021/11/"><span class="card-archive-list-date">November 2021</span><span class="card-archive-list-count">21</span></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2021/09/"><span class="card-archive-list-date">September 2021</span><span class="card-archive-list-count">4</span></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2021/07/"><span class="card-archive-list-date">July 2021</span><span class="card-archive-list-count">2</span></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2021/06/"><span class="card-archive-list-date">June 2021</span><span class="card-archive-list-count">3</span></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2021/05/"><span class="card-archive-list-date">May 2021</span><span class="card-archive-list-count">3</span></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2021/04/"><span class="card-archive-list-date">April 2021</span><span class="card-archive-list-count">16</span></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2021/03/"><span class="card-archive-list-date">March 2021</span><span class="card-archive-list-count">75</span></a></li></ul></div><div class="card-widget card-webinfo"><div class="item-headline"><i class="fas fa-chart-line"></i><span>Info</span></div><div class="webinfo"><div class="webinfo-item"><div class="item-name">Article :</div><div class="item-count">127</div></div><div class="webinfo-item"><div class="item-name">UV :</div><div class="item-count" id="busuanzi_value_site_uv"></div></div><div class="webinfo-item"><div class="item-name">PV :</div><div class="item-count" id="busuanzi_value_site_pv"></div></div><div class="webinfo-item"><div class="item-name">Last Push :</div><div class="item-count" id="last-push-date" data-lastPushDate="2021-12-25T10:41:59.790Z"></div></div></div></div></div></div></main><footer id="footer" style="background-image: url('/img/back.jpg')"><div id="footer-wrap"><div class="copyright">&copy;2020 - 2021 By Ywrby</div></div></footer></div><div id="rightside"><div id="rightside-config-hide"><button id="darkmode" type="button" title="Switch Between Light And Dark Mode"><i class="fas fa-adjust"></i></button><button id="hide-aside-btn" type="button" title="Toggle between single-column and double-column"><i class="fas fa-arrows-alt-h"></i></button></div><div id="rightside-config-show"><button id="rightside_config" type="button" title="Setting"><i class="fas fa-cog fa-spin"></i></button><button id="go-up" type="button" title="Back To Top"><i class="fas fa-arrow-up"></i></button></div></div><div id="local-search"><div class="search-dialog"><div class="search-dialog__title" id="local-search-title">Local search</div><div id="local-input-panel"><div id="local-search-input"><div class="local-search-box"><input class="local-search-box--input" placeholder="Search for Posts" type="text"/></div></div></div><hr/><div id="local-search-results"></div><span class="search-close-button"><i class="fas fa-times"></i></span></div><div id="search-mask"></div></div><div><script src="/js/utils.js"></script><script src="/js/main.js"></script><script src="/js/search/local-search.js"></script><div class="js-pjax"><script>function subtitleType () {
  if (true) { 
    var typed = new Typed("#subtitle", {
      strings: "Less is more".split(","),
      startDelay: 300,
      typeSpeed: 150,
      loop: true,
      backSpeed: 50
    })
  } else {
    document.getElementById("subtitle").innerHTML = 'L'
  }
}

if (true) {
  if (typeof Typed === 'function') {
    subtitleType()
  } else {
    getScript('https://cdn.jsdelivr.net/npm/typed.js/lib/typed.min.js').then(subtitleType)
  }
} else {
  subtitleType()
}</script></div><div class="aplayer no-destroy" data-id="5402995011" data-server="netease" data-type="playlist" data-fixed="true" data-mini="true" data-listFolded="false" data-lrctype=0	data-order="random" data-preload="none" data-autoplay="true" muted></div><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.css" media="print" onload="this.media='all'"><script src="https://cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.js"></script><script src="https://cdn.jsdelivr.net/gh/metowolf/MetingJS@1.2/dist/Meting.min.js"></script><script src="https://cdn.jsdelivr.net/npm/pjax/pjax.min.js"></script><script>let pjaxSelectors = [
  'title',
  '#config-diff',
  '#body-wrap',
  '#rightside-config-hide',
  '#rightside-config-show',
  '.js-pjax'
]

if (false) {
  pjaxSelectors.unshift('meta[property="og:image"]', 'meta[property="og:title"]', 'meta[property="og:url"]')
}

var pjax = new Pjax({
  elements: 'a:not([target="_blank"])',
  selectors: pjaxSelectors,
  cacheBust: false,
  analytics: false,
  scrollRestoration: false
})

document.addEventListener('pjax:send', function () {

  // removeEventListener scroll 
  window.removeEventListener('scroll', window.tocScrollFn)
  window.removeEventListener('scroll', scrollCollect)

  typeof preloader === 'object' && preloader.initLoading()
  
  if (window.aplayers) {
    for (let i = 0; i < window.aplayers.length; i++) {
      if (!window.aplayers[i].options.fixed) {
        window.aplayers[i].destroy()
      }
    }
  }

  typeof typed === 'object' && typed.destroy()

  //reset readmode
  const $bodyClassList = document.body.classList
  $bodyClassList.contains('read-mode') && $bodyClassList.remove('read-mode')

})

document.addEventListener('pjax:complete', function () {
  window.refreshFn()

  document.querySelectorAll('script[data-pjax]').forEach(item => {
    const newScript = document.createElement('script')
    const content = item.text || item.textContent || item.innerHTML || ""
    Array.from(item.attributes).forEach(attr => newScript.setAttribute(attr.name, attr.value))
    newScript.appendChild(document.createTextNode(content))
    item.parentNode.replaceChild(newScript, item)
  })

  GLOBAL_CONFIG.islazyload && window.lazyLoadInstance.update()

  typeof chatBtnFn === 'function' && chatBtnFn()
  typeof panguInit === 'function' && panguInit()

  // google analytics
  typeof gtag === 'function' && gtag('config', '', {'page_path': window.location.pathname});

  // baidu analytics
  typeof _hmt === 'object' && _hmt.push(['_trackPageview',window.location.pathname]);

  typeof loadMeting === 'function' && document.getElementsByClassName('aplayer').length && loadMeting()

  // Analytics
  if (false) {
    MtaH5.pgv()
  }

  // prismjs
  typeof Prism === 'object' && Prism.highlightAll()

  typeof preloader === 'object' && preloader.endLoading()
})

document.addEventListener('pjax:error', (e) => {
  if (e.request.status === 404) {
    pjax.loadUrl('/404.html')
  }
})</script><script async data-pjax src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script></div></body></html>